import axios from 'axios';

// 列表分页
export const getOnething = (data) =>
  axios.request({
    url: '/api/v1/event/one-thing/page',
    method: 'get',
    params: data
  });

// 提交状态审核
export const stateApproval = (params) =>
  axios.request({
    url: '/api/v1/event/one-thing/stateApproval/' + params.thingId,
    method: 'get',
    params: {
      reason: params.reason
    }
  });
// 审核
export const approved = (params) =>
  axios.request({
    url: '/api/v1/event/one-thing/approved/' + params.thingId,
    method: 'get',
    params: {
      reason: params.reason,
      type: params.type
    }
  });
// 失效
export const invalid = (params) =>
  axios.request({
    url: '/api/v1/event/one-thing/invalid/' + params.thingId,
    method: 'get',
    params: {
      reason: params.reason
    }
  });
// 生效
export const takeEffect = (params) =>
  axios.request({
    url: '/api/v1/event/one-thing/takeEffect',
    method: 'get',
    params: params
  });
// 获取事项列表
export const getMatterList = (params) =>
  axios.request({
    url: '/api/v1/event/implementation/pageByOneThing',
    method: 'get',
    params
  });

// 根据ID获取数据
export const getOnethingDetails = (thingId) =>
  axios.request({
    url: '/api/v1/event/one-thing/' + thingId,
    method: 'get'
  });

// 新增一件事
export const addOneThing = (params) => axios.post('/api/v1/event/one-thing', params);

// 修改一件事
export const updateOneThing = (params) => axios.put('/api/v1/event/one-thing', params);

// 获取部门树
export const getDepartTree = (params) => axios.get('/api/v1/event/implementation/getDepartTree', params);
